package com.udhtu.ii.lab4;


public class Layer {

    private Neuron[] neurons;
    private double[] out;

    public Layer(int count,double[][] weights,double[] in,int fun){
        neurons=new Neuron[count];
        out=new double[count];
        this.setNeurons(weights,in,fun);
        this.setOut();
    }

    public void setNeurons(double[][] weigths,double[] in,int fun) {
        try{
        for (int i=0;i<weigths.length;i++){
               neurons[i]=new Neuron(weigths[i].length,weigths[i],in,fun);

        } }
        catch (ArrayIndexOutOfBoundsException ex){
            ex.printStackTrace();
        }
    }

    public void setOut(){
        for (int i=0;i<neurons.length;i++){
            out[i]=neurons[i].getIn();
        }
    }

    public double[] getOut(){
        return this.out;
    }
}
